FLAGS= -g -shared -o
INCLUDE= -I$(CUBESYSPATH)/include/ -I$(CUBELIBPATH)/include -I$(CUBEAPPPATH)/include
CFLAGS= -g -c -fPIC -DUSER_MODE $(INCLUDE)
CC=gcc
CCP=g++
PLUGIN=tsmd
PLUGIN_OBJ= tcm_func.o
TEST_LIB= -L$(CUBELIBPATH)/lib -lsys_func -lchannel -lexmodule -lmessage -lmemdb -lconnector -lstruct -lcrypto_func -ljson -lstring -lalloc -lpthread -lsm2So
LOCALLIB=-L$(CUBEAPPPATH)/locallib/bin -lauth_func -lvtcm_ex_alg

main: lib$(PLUGIN).so $(PLUGIN_OBJ)
lib$(PLUGIN).so:  $(PLUGIN).o $(PLUGIN_OBJ) 
	$(CC) $(FLAGS) lib$(PLUGIN).so $(PLUGIN).o $(PLUGIN_OBJ) $(TEST_LIB) $(LOCALLIB)
	mv lib$(PLUGIN).so $(CUBEAPPPATH)/plugin
	cp $(PLUGIN).cfg $(CUBEAPPPATH)/plugin
$(PLUGIN).o: $(PLUGIN).c $(PLUGIN).h
	$(CC) $(CFLAGS) $(PLUGIN).c
tcm_func.o: tcm_func.c
	$(CC) $(CFLAGS) tcm_func.c
	
clean:
	rm -f lib$(PLUGIN).so 
	rm  *.o *~
